#!/bin/bash
cd ~/app-root/data/github-sh/pkg/
curl -s https://github.com/googlei18n/noto-cjk/releases|grep -o googlei18n/noto-cjk/archive/.*.zip >1.txt
if ! grep $(cat 1.txt) ~/app-root/data/temp/pkg/noto-fonts-sc/PKGBUILD; then
sed -i -e "s#googlei18n/noto-cjk/archive/.*.zip#$(cat 1.txt)#" -e "/pkgver/s#[0-9]\{8\}#"$(date -u +%Y%m%d)"#" ~/app-root/data/temp/pkg/noto-fonts-sc/PKGBUILD
sed -i "/pkgver/s#[0-9]\{8\}#"$(date -u +%Y%m%d)"#" ~/app-root/data/temp/pkg/noto-fonts-sc/.SRCINFO
fi
cd ~/app-root/data/temp/pkg/
diff -q noto-fonts-sc/ tmp/noto-fonts-sc/ | sed -e 's#Files ##' -e 's#and.*differ##' >diff.txt
zip pkg.zip -r $(cat diff.txt)
rm -rf noto-fonts-sc/ ~/app-root/data/github-sh/pkg/1.txt
